<?php

namespace App\Model;

use Util\Common;

/**
 * 充电套餐详情表
 */
class ChargeDetail extends Model
{
//    use TimeZoneTrait;

    const POWER_TYPE = 1; //功率选项
    const TIME_TYPE = 2; //时间选项

    const ELEC_TYPE = 3;//电量选项

    const SERVICE_TYPE = 4;//服务费选项
    public bool $timestamps = true;

    protected ?string $table = 'charge_detail';


    protected array $fillable = [
        'id', 'charge_option_id','fee','minutes','sort',
        'min_power','max_power','type','is_del'
    ];

    protected array $casts = [
        'created_at' => 'datetime:Y-m-d H:i:s',
        'updated_at' => 'datetime:Y-m-d H:i:s',
    ];

    public function orders(){
        return $this->hasMany(Order::class,'charge_detail_id','id');
    }

    public function chargeOption(){
        return $this->belongsTo(ChargeOption::class,'charge_option_id','id');
    }

}
